package cn.joechow.quickcode.genterator;

import freemarker.template.TemplateException;

import java.io.IOException;
import java.util.List;

/**
 * Created by JoeChow
 * on 2017/1/23.
 */
public class AsyncQuickCode implements Runnable {

    public void run(){
        System.out.println("why");
    }


    public void run(String test) {
        QuickCode.info("Go Thread ...");

        QuickCode.info("Single : " + this.single);
        QuickCode.info("Multi : " + this.multi);

        /*if(single){
            try {
                QuickCode.info("Go Single ...");
                QuickCode.gen(this.templateDir,this.templateName,this.targetDir,this.targetName,this.data);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (TemplateException e) {
                e.printStackTrace();
            }
        }else if(multi){
            try {
                QuickCode.info("Go Multi ...");
                QuickCode.gen(this.templateDir,this.templateName,this.targetDir,this.targetNameList,this.dataList);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (TemplateException e) {
                e.printStackTrace();
            }
        }*/
    }

    private boolean single = false;
    private String templateDir;
    private String templateName;
    private String targetDir;
    private String targetName;
    private Object data;

    private boolean multi = false;
    private List<String> targetNameList;
    private List<Object> dataList;

    public AsyncQuickCode(String templateDir, String templateName, String targetDir, String targetName, Object data) {
        this.templateDir = templateDir;
        this.templateName = templateName;
        this.targetDir = targetDir;
        this.targetName = targetName;
        this.data = data;
        this.single = true;
    }

    public AsyncQuickCode(String templateDir, String templateName, String targetDir, List<String> targetNameList, List<Object> dataList) {
        this.templateDir = templateDir;
        this.templateName = templateName;
        this.targetDir = targetDir;
        this.targetNameList = targetNameList;
        this.dataList = dataList;
        this.multi = true;
    }
}
